<!--
 * @Author: wangming
 * @Date: 2021-04-22 17:56:33
 * @LastEditors: wangming
 * @LastEditTime: 2021-04-22 17:56:58
 * @Description: file content
-->
<!--
 * @Author: wangming
 * @Date: 2021-04-01 17:15:13
 * @LastEditors: wangming
 * @LastEditTime: 2021-04-21 14:13:26
 * @Description: file content
-->
<template>
  <div>
    <el-form-item label="是否启用拖拽上传" class="tr">
      <el-switch v-model="value.__config.drag"></el-switch>
    </el-form-item>
    <el-form-item label="模板" class="tr">
      <div
        class="filebox ks-row-middle bgwh"
        v-if="!!value.__config.tempalteURL"
      >
        <div class="g3 ks-col ell f14">
          {{ value.__config.tempalteURL }}
        </div>
        <el-button
          type="text"
          icon="el-icon-download"
          @click="download(value.__config.tempalteURL)"
          >下载</el-button
        >
        <el-button
          type="text"
          icon="el-icon-delete"
          @click="value.__config.tempalteURL = ''"
          >删除
        </el-button>
      </div>
      <common-upload
        v-else
        client
        @success="handleUploadSuccess"
        accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
      >
        <el-button icon="el-icon-upload2" size="mini">上传</el-button>
      </common-upload>
    </el-form-item>
  </div>
</template>
<script>
import basicmixins from "./basicmixins";
export default {
  mixins: [basicmixins],
  data() {
    return {};
  },
  methods: {
    handleUploadSuccess(res) {
      this.$set(this.value.__config, "tempalteURL", res);
    },
  },
};
</script>

<style lang="scss" scoped>
.filebox {
  // width: 280px;
  height: 28px;
  border-radius: 2px;
  padding: 0 8px;
  background: #f4f9ff;
  margin-bottom: 8px;
}
</style>
